﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace SSMS_Scripter
{
    /// <summary>
    /// Dialog listing options for processing cubes
    /// </summary>
    public partial class ProcessCubes : Form
    {

        // Link back to original menu item
        MenuItem parent;

        public ProcessCubes()
        {
            InitializeComponent();
        }

        public ProcessCubes(MenuItem mi, object sender)
            : this()
        {
            parent = mi;
            plProcess.LoadControl(mi.GetCubes(sender), false, mi);
        }

        /// <summary>
        /// Create process script
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void btnProcess_Click(object sender, EventArgs e)
        {
            string result = plProcess.GetQuery();
            parent.CreateProcessTask(result);
            this.Close();
        }
    }
}
